<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            display: flex;
        }
        div{
            width: 90px;
            height: 90px;
            margin: 5px;
            border-radius: 5px;
        }
    </style>
</head>
<body>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <script>
        let arr = [0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f']
        let cr = '#'
        for(i=1;i<=6;i++){
            cr += arr[Math.floor(Math.random()*arr.length)]
        }
        const box = document.querySelectorAll('div')
        for(let j=0;j<box.length;j++){
            box[j].style.backgroundColor=cr
        }
        // box.style.backgroundColor=cr
        // console.log(color)
    </script>
</body>
</html>